<%- url ||= url_for({ action: 'index' }.merge(
  q: search_filter_params[:q]&.except(resource_handler.search_field_name),
  form_field_id: @form_field_id,
  size: @size
)) -%>

<%= search_form_for @query, url: url_for(action: 'index', size: @size), html: {class: 'search_form', id: "resource_search"} do |f| %>
  <%= hidden_field_tag :form_field_id, @form_field_id %>
  <div class="search_field">
    <button type="submit">
      <%= render_icon('search') %>
    </button>
    <%= f.search_field resource_handler.search_field_name,
      placeholder: Alchemy.t(:search),
      class: 'search_input_field',
      id: nil %>
    <%= link_to render_icon(:times, size: '1x'), url,
      class: 'search_field_clear',
      title: Alchemy.t(:click_to_show_all),
      style: search_filter_params.fetch(:q, {}).fetch(resource_handler.search_field_name, '').present? ? 'visibility: visible' : 'visibility: hidden' %>
  </div>
<% end %>
